// pages/single/single.js
var ajax = require("../../utils/network.js");
var WxParse = require('../../wxParse/wxParse.js'); 
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },
  onLoad: function (options) {
    var id = options.id;
    this.setData({
      id: id
    })
    this.getDitail();
  },

  getDitail: function () {
    var that = this;
    var URL = ajax.server() + 'cloud-dynamic/info';
    var Params = { cd_id: that.data.id };
    var Method = 'GET';
    var Message = '';
    ajax.requestLoading(URL, Params, Method, Message, function (res) {
      console.log('详情---', res)
      if (res.code == 0) {
        var title = res.data.title;
        var create_time = res.data.create_time;
        var article = res.data.content;
        var image = res.data.image;
        that.setData({
          title: title,
          image: image,
          create_time: ajax.appTime(create_time),
          content: WxParse.wxParse('article', 'html', article, that, 5)
        })
      }
    }, function () {})
  },
})